<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml" 
	xmlns:s="http://sduept.security.el/func">
<ui:define name="head">
	<link rel="stylesheet" href="/resources/plugins/datatables/dataTables.bootstrap.css" />
<style>
#accountInfo .box-header {
	padding: 19px;
}

#statistics .box-title {
	font-size: 16px;
}

#vol p:nth-child(2) {
	font-size: 15px;
}

select {
	color: black;
}

.ui-autocomplete-input {
	width: 100%;
}
</style>
</ui:define>
<ui:define name="content">
	<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
		<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
		<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
	</p:confirmDialog>
	<div class="full-center-content-scroll-noheader">
		<!-- 新建账号dialog -->
		<h:form id="dialogForm">
			<p:dialog widgetVar="dialogDialog" id="dialogDialog" header="新增账号" modal="true" width="410" height="370">
				<!-- <p:growl id="growl" sticky="true" showDetail="true"/> -->
			    <p:wizard flowListener="#{mobileUserInfoController.onFlowProcess}">
			        <p:tab id="peopleSelect" title="人员选择">
			            <p:panel header="People Details">
			                <p:messages />
			                <h:panelGrid columns="2">
			                    <p:commandButton value="选择人员" icon="ui-icon-extlink" actionListener="#{mobileUserInfoController.chooseUser()}" 
									rendered="#{s:hasPermission(session,'xtsz_yddxxtssz_xzry')}">
									<p:ajax event="dialogReturn" listener="#{mobileUserInfoController.onUsersChosen}" 
									update="sysUser" />
								</p:commandButton>
			                </h:panelGrid>
			            </p:panel>
			        </p:tab>
			        <p:tab id="peopleSelectedCheck" title="人员选择校验">
			            <p:panel header="People Checked Details">
			                <p:messages />
			                <p:panelGrid columns="2">
			                    <h:outputText value="当前选择：*" />
			                    <p:inputText id="sysUser" value="#{mobileUserInfoController.sysUserName}" required="true" label="当前选择的人员" />
								<h:outputText value="4A账号：*" />
								<p:inputText value="#{mobileUserInfoController.account}" style="width:100%" required="true" label="4A账号" />
							</p:panelGrid>
			            </p:panel>
			        </p:tab>
		            <p:tab id="confirm" title="信息确认">
		            	<p:panel header="Confirmation Details">
			            	<!-- <p:messages /> -->
			                <p:panelGrid columns="2">
								<h:outputText value="用户姓名：" />
								<h:outputText value="#{mobileUserInfoController.realName}" styleClass="outputLabel" />
								<h:outputText value="4A账号：" />
								<h:outputText value="#{mobileUserInfoController.account}" styleClass="outputLabel" />
							</p:panelGrid>
		                 	<p:commandButton value="保存" actionListener="#{mobileUserInfoController.createUser}" 
			                	update="infoForm:infoMsgs infoForm:infoTable dialogForm dialogForm:dialogDialog" 
			                	 oncomplete="PF('dialogDialog').hide()"/>
			            </p:panel>
			        </p:tab>
			    </p:wizard>
			</p:dialog>
		</h:form>
		<h:form id="infoForm">
			<p:growl id="infoMsgs" showDetail="true"/>
			<div class="box box-solid with-border">
				<div class="box-header">
					<h:outputText value="用户姓名：" />
					<p:inputText  id="searchVal" 
						value="#{mobileUserInfoController.mbUserName}"/>
					<p:commandButton value="搜索"
						actionListener="#{mobileUserInfoController.search}" 
						update="infoTable infoSearchTools infoMsgs" icon="ui-icon-search" style="margin-left:5px"/>
					<p:commandButton value="重置"
						actionListener="#{mobileUserInfoController.refresh}"
						update="infoTable infoSearchTools searchVal" icon="ui-icon-refresh" />
				</div>
			</div>
			<p:toolbar id="infoSearchTools">
				<f:facet name="left">
					<p:commandButton id="newMobileUser" value="新建" icon="ui-icon-document" 
						update="infoForm:infoTable infoForm:infoMsgs" oncomplete="PF('dialogDialog').show()" 
						rendered="#{s:hasPermission(session,'xtsz_yddxxtssz_xj')}"/>
					<p:commandButton id="editMobileUser" value="编辑" icon="ui-icon-document"  
						update="editForm" oncomplete="PF('editDlg').show()"  disabled="#{!mobileUserInfoController.deshowed}" 
						rendered="#{s:hasPermission(session,'xtsz_yddxxtssz_xj')}"/>
					<p:commandButton id="delMobileUser" value="删除" icon="ui-icon-trash" 
						update="infoForm:infoTable infoMsgs infoSearchTools" actionListener="#{mobileUserInfoController.deleteUser}" 
						disabled="#{!mobileUserInfoController.deshowed}" 
						rendered="#{s:hasPermission(session,'xtsz_yddxxtssz_sc')}">
						<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
					</p:commandButton>
				</f:facet>
			</p:toolbar>
			<p:remoteCommand name="onCellEdit" update="" />
			<p:dataTable id="infoTable" var="mobileUs" rowKey="#{mobileUs.id}" rowIndexVar="ite"
				value="#{mobileUserInfoController.mobileUserInfo}" emptyMessage="暂无记录" lazy="true" selection="#{mobileUserInfoController.selectMu}" 
				style="margin-bottom: 20px" rows="20" paginator="true" paginatorPosition="bottom" 
				paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
				rowsPerPageTemplate="20,50,100">
				<f:facet name="{Customization}">
					<p:outputLabel value="总计：#{mobileUserInfoController.mobileUserInfo.rowCount} 条记录" style="margin-right:20px;" />
				</f:facet>
				<p:ajax event="rowSelectRadio" listener="#{mobileUserInfoController.onRowSelect}"
					update="infoForm:infoSearchTools" />
				<p:ajax event="cellEdit" oncomplete="onCellEdit()" update="infoForm:infoMsgs infoTable" listener="#{mobileUserInfoController.editUser}" />
				<p:column selectionMode="single" style="text-align:center;width:60px" />
				<p:column headerText="序号" style="text-align:center;width:60px">
					<h:outputText value="#{ite+1}" />
				</p:column>
				<p:column headerText="用户姓名">
					<h:outputText value="#{mobileUs.realName}" />
				</p:column>
				<p:column headerText="4A账号">
					<h:outputText value="#{mobileUs.account}" />
				</p:column>
				<p:column headerText="系统账号">
					<h:outputText value="#{mobileUs.name}" />
				</p:column>
			</p:dataTable>
		</h:form>
		<h:form id="editForm">
				<p:dialog widgetVar="editDlg" header="修改信息" modal="true" id="editDlg" width="400" height="300">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton id="createSaveBtn" value="保存" actionListener="#{mobileUserInfoController.save}" icon="fa fa-floppy-o" 
							update="infoForm:infoTable" oncomplete="PF('editDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="editDetail" style=" text-align:center; width:100%;">
						<p:panelGrid columns="2">
		                    <h:outputText value="当前选择：*" />
		                    <p:inputText id="sysUser" value="#{mobileUserInfoController.selectMu.realName}" required="true" label="当前选择的人员" />
							<h:outputText value="4A账号：*" />
							<p:inputText value="#{mobileUserInfoController.selectMu.account}" style="width:100%" required="true" label="4A账号" />
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
	</div>
</ui:define>
</ui:composition>